package com.mifengs.mall.netWork;

import com.mifengs.commonbase.net.NetConfig;
import com.mifengs.commonbase.net.NetRetorfit;
import com.mifengs.mall.Constant;
import com.mifengs.mall.MallApplication;
import com.mifengs.mall.netWork.api.AppLaunchApi;
import com.mifengs.mall.netWork.api.HomeDataApi;
import com.mifengs.mall.netWork.api.ImageUploadApi;
import com.mifengs.mall.netWork.api.LoginApi;
import com.mifengs.mall.netWork.api.MaterialSubApi;
import com.mifengs.mall.netWork.api.MsgCenterApi;
import com.mifengs.mall.netWork.api.MyMsgApi;
import com.mifengs.mall.netWork.api.OrderPayApi;
import com.mifengs.mall.netWork.api.RedPacketApi;
import com.mifengs.mall.netWork.api.RegisterApi;
import com.mifengs.mall.netWork.api.UpdateAppApi;
import com.alibaba.sdk.android.httpdns.HttpDns;
import com.alibaba.sdk.android.httpdns.HttpDnsService;

import java.net.MalformedURLException;
import java.net.URL;

import retrofit2.CallAdapter;
import retrofit2.Converter;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by Administrator on 2017/10/24.
 */

public class NetWork {

    private static RegisterApi registerApi;
    private static UpdateAppApi updateAppApi;
    private static HomeDataApi homeDataApi;
    private static LoginApi loginApi;
    private static OrderPayApi orderPayApi;
    private static MsgCenterApi msgCenterApi;
    private static MyMsgApi myMsgApi;
    private static RedPacketApi redPacketApi;
    private static AppLaunchApi appLaunchApi;
    private static ImageUploadApi imageUploadApi;
    private static MaterialSubApi mMaterialSubApi;


    public static UpdateAppApi getApplyGoodsApi() {
        if (updateAppApi == null) {
            Retrofit retrofit = NetRetorfit.getCommonRetrofit();
            updateAppApi = retrofit.create(UpdateAppApi.class);
        }
        return updateAppApi;
    }

    public static HomeDataApi getHomeDataApi() {
        if (homeDataApi == null) {
            Retrofit retrofit = NetRetorfit.getCommonRetrofit();
            homeDataApi = retrofit.create(HomeDataApi.class);
        }
        return homeDataApi;
    }

    public static RegisterApi getRegisterApi() {
        if (registerApi == null) {
            Retrofit retrofit = NetRetorfit.getrRegRetrofit();
            registerApi = retrofit.create(RegisterApi.class);
        }
        return registerApi;
    }

    public static LoginApi getLoginApi() {
        if (loginApi == null) {
//            Retrofit retrofit = getLrRetrofit();
            Retrofit retrofit = NetRetorfit.getCommonRetrofit();
            loginApi = retrofit.create(LoginApi.class);
        }
        return loginApi;
    }

    public static LoginApi getFindPWApi() {
        if (loginApi == null) {
            Retrofit retrofit = NetRetorfit.getCommonRetrofit();
            loginApi = retrofit.create(LoginApi.class);
        }
        return loginApi;
    }

    public static OrderPayApi getOrderPayApi() {
        if (orderPayApi == null) {
            Retrofit retrofit = NetRetorfit.getCommonRetrofit();
            orderPayApi = retrofit.create(OrderPayApi.class);
        }
        return orderPayApi;
    }

    public static MsgCenterApi getMsgCenterApi() {
        if (msgCenterApi == null) {
            Retrofit retrofit = NetRetorfit.getCommonRetrofit();
            msgCenterApi = retrofit.create(MsgCenterApi.class);
        }
        return msgCenterApi;
    }

    public static MyMsgApi getMyMsgApi() {
        if (myMsgApi == null) {
            Retrofit retrofit = NetRetorfit.getCommonRetrofit();
            myMsgApi = retrofit.create(MyMsgApi.class);
        }
        return myMsgApi;
    }

    public static RedPacketApi getRedPacketApi() {
        if (redPacketApi == null) {
            Retrofit retrofit = NetRetorfit.getCommonRetrofit();
            redPacketApi = retrofit.create(RedPacketApi.class);
        }
        return redPacketApi;
    }

    public static AppLaunchApi getAppLaunchApi() {
        if (appLaunchApi == null) {
            Retrofit retrofit = NetRetorfit.getCommonRetrofit();
            appLaunchApi = retrofit.create(AppLaunchApi.class);
        }
        return appLaunchApi;
    }

    public static ImageUploadApi getImageUploadApi() {
        if (imageUploadApi == null) {
            Retrofit retrofit = NetRetorfit.getCommonRetrofit();
            imageUploadApi = retrofit.create(ImageUploadApi.class);
        }
        return imageUploadApi;
    }

    public static MaterialSubApi getMaterialSubApi() {
        if (mMaterialSubApi == null) {
            Retrofit retrofit = NetRetorfit.getCommonRetrofit();
            mMaterialSubApi = retrofit.create(MaterialSubApi.class);
        }
        return mMaterialSubApi;
    }

}
